# requests>urllib>socket
import socket
from urllib.parse import urlparse

def get_content(url):
    url = urlparse(url)
    host=url.netloc
    path=url.path
    if path=="":
        path="/"


    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.connect((host, 80))
    client_socket.send("GET {} HTTP/1.1\r\nHost:{}\r\nConnection:close\r\n\r\n".format(path, host).encode())
    data=b""
    while True:
        d = client_socket.recv(1024)
        if not d:
            break
        data += d

    print(data.decode())
    client_socket.close()


if __name__ == '__main__':
    get_content("http://www.baidu.com")